package linkedListDemo;

import java.util.ArrayList;
import java.util.LinkedList;

public class Demo {
	public static void main(String[] args){
		
		ArrayList arrayList = new ArrayList();
		arrayList.add("a");
		arrayList.add("b");
		arrayList.add("c");
		String str1 = (String)arrayList.get(0);  //get first
		String str2 = (String)arrayList.get(arrayList.size()-1); //get last
		System.out.println(str1);
		System.out.println(str2);

		LinkedList linkedList = new LinkedList();
		linkedList.add("aaa");
		linkedList.add("bbb");		
		linkedList.add("ccc");
		linkedList.set(1, "j");
		System.out.println(linkedList);
		String s1 = (String)linkedList.getFirst();   //get first
		String s2 = (String)linkedList.getLast();    //get last
		System.out.println(s1);
		System.out.println(s2);
		
		LinkedList<String> linkedList2 = new LinkedList<String>();
	}
}
class Person{}
